package B.w.OOday01;
/**学生类*/
//看到括号就是调用方法，可看到new就是调用构造（出厂设置）方法外-成员变量 方法内-局部变量-当前方法 俩变量可同名（默认就近远原则）
public class Student {
    String name;
    int age;
    String className;
    String stuID;

    Student() {
    }

    Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    Student(String name, int age, String className, String stuID) {
        this.name = name;
        this.age = age;
        this.className = className;
        this.stuID = stuID;
    }

    void study() {
        System.out.println(name+"在学习");
    }

    void sayHi() {
        System.out.println("你好，我是"+this.name+"， 今年"+this.age+"岁了，所在班级为"+this.className+"，学号为:"+this.stuID);
    }

    void playWith(String anotherName) {
        System.out.println(this.name+"正在锤"+anotherName+"小老弟");
    }
    void sleep(){
        System.out.println(this.name+"正在睡觉");
    }








































    /*String name;
    int age;
    String className;
    String stuID;

    Student(){
    }
    Student(String name,int age){
        this.name=name;
        this.age=age;
    }
    Student(String name,int age,String className,String stuID){
        this.name=name;
        this.age=age;
        this.className=className;
        this.stuID=stuID;
    }
    void study() {
        System.out.println(name + "在学习...");
    }
        void sayHi(){
            System.out.println("大家好，我叫"+name+"今年"+age+"岁了，所在班级为"+className+"学号为："+stuID);
        }
        void playWith(String anotherName){
            System.out.println(name+"正在和"+anotherName+"一起玩");*/
        }

